package com.acme.task3;

public class Task3Arrays {
    public static void main(String[] args) {
        // 1
        int n = 50;
        for (int i = 1; i <= n; i++) {
            System.out.println(i);
        }

        // 2
        int m = 21;
        int d = 3;
        for (int i = 1; i <= m; i += 1) {
            if (i % d == 0) {
                System.out.println("Число " + i + " кратно " + d);
            }
        }

        // 3
        int p = 51;
        int [] arr = new int[p];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = i + 1;
        }
        System.out.println(avg(arr));
    }
    public static double avg(final int[] arr) {
        if (arr.length == 0) {
            return 0;
        }
        double sum = 0;
        for (int el : arr) {
            sum += el;
        }
        return sum / arr.length;
    }
}
